import React, { PureComponent } from 'react'
// ref
// 标签上 --- DOM操作
// 组件上 --- 获取子组件的实例
class Child extends PureComponent {
  state = {
    a: 1000
  }
  render () {
    return (
      <div>
        {
          this.state.a
        }
      </div>
    )
  }
}
export default class App extends PureComponent {
  oDivRef = React.createRef()
  childRef = React.createRef()
  render() {
    return (
      <div>
        <div ref= { this.oDivRef }>abcd</div>
        <Child ref = { this.childRef }/>
      </div>
    )
  }
  componentDidMount () {
    console.log(this.oDivRef.current.innerHTML)
    console.log(this.childRef.current.state.a)
  }
}
